export class Init{
    constructor(Param){
        this.container = Param.container;
        this.camera = Param.camera;
        this.scene = Param.scene;
        this.light = Param.light;
        this.renderer = Param.renderer;
        this.windowHalfX = Param.windowHalfX;
        this.windowHalfY = Param.windowHalfY;
        this.orbitControls = Param.orbitControls
        this.axesHelper = Param.axesHelper
    }
    initCamera(){}
    initLight(){}
    initRender(){}
    initOrbit(){}
    initScene(){}
    initWindowResize(){}
    initEventListener(){}
}


export class InitDataCenter extends Init{
    constructor(param){
        super(param)
    }
    initCamera(){
        this.camera.position.set( 12,15, -40);
    }
    initLight(){
        this.light.intensity = 1.7;
    }
    initRender(){
        this.renderer.setClearColor(new THREE.Color(0x0e0e0e),0);
        this.renderer.setPixelRatio( window.devicePixelRatio );
        this.renderer.setSize( window.innerWidth, window.innerHeight );
        this.container.appendChild(this.renderer.domElement)
    }
    initOrbit(){
        this.orbitControls.maxPolarAngle = 0.8 * Math.PI / 2;
        this.orbitControls.enableZoom = true;
        this.orbitControls.keys = { LEFT: 39, UP: 40, RIGHT: 37, BOTTOM: 38 };
        this.orbitControls.maxDistance = 100;
    }
    initScene(){
        this.scene.add( this.light );
        this.scene.add(this.camera);
        this.scene.add(this.axesHelper)
    }
    initWindowResize(){
        this.windowHalfX = window.innerWidth / 2;
        this.windowHalfY = window.innerHeight / 2;
        this.camera.aspect = window.innerWidth / window.innerHeight;
        this.camera.updateProjectionMatrix();
        this.renderer.setSize( window.innerWidth, window.innerHeight );
    }
    initEventListener(){
        window.addEventListener('resize',this.initWindowResize ,false)
    }
    addContextEventListener(event,functionName,useCapture){
        this.renderer.domElement.addEventListener(event, functionName, useCapture);
    }

    initAll(){
        this.initCamera();
        this.initLight();
        this.initRender();
        this.initOrbit();
        this.initScene();
        this.initWindowResize();
        this.initEventListener();

    }
    toString(){
        console.log("hello")
    }
}
